#ifndef __graph_H__
#define __graph_H__

#define Default_Vertex_Size 10
#define datatype char

typedef struct Edge
{
	int dest;
	struct Edge *link;
} Edge;

typedef struct Vertex
{
	datatype data;
	Edge *adj;
} Vertex;

typedef struct Graph
{
	int MaxVertex;
	int NumVertex;
	int NumEdge;
	Vertex *NodeTable;
} Graph;

int Init(Graph *graph);
int InsertVertex(Graph *graph, datatype data);
int InsertEdge(Graph *graph, datatype vertex1, datatype vertex2); //有向图插入边和无向图不同
int GetVertexPosion(Graph *graph, datatype vertex);
void Show(Graph *graph);
int RemoveEdge(Graph *graph, datatype vertex1, datatype vertex2); //有向图删除边和无向图不同
int RemoveVertex(Graph *graph, datatype vertex);
void Destory(Graph *graph);
int GetFirstNeighbor(Graph *graph, datatype vertex);
int GetNextNeighbor(Graph *graph, datatype vertex1, datatype vertex2);
//==========================================================
int TopologicalSort(Graph *graph);

#endif
